from django.conf.urls import url

from . import views, views_seri, views_api, views_generic, views_generic_2, views_view_set, views_generic_view_set, views_model_view_set
from . import views_model_view_set_2
from rest_framework.routers import SimpleRouter, DefaultRouter

# urlpatterns = [
#     url(r'^books/$', views_generic_2.BooksView.as_view()),
#     url(r'^book/(?P<pk>\d+)/$', views_generic_2.BookView.as_view()),
# ]

# urlpatterns = [
#     url(r'^books/$', views_set.BooksView.as_view()),
#     url(r'^book/(?P<pk>\d+)/$', views_set.BookView.as_view()),
# ]

urlpatterns = [
    # url(r'^books/$', views_model_view_set.BookViewSet.as_view({'get': 'list', 'post': 'create'})),
    # url(r'^books/(?P<pk>\d+)/$', views_model_view_set.BookViewSet.as_view({'get': 'retrieve', 'put': 'update', 'delete': 'destroy'})),
    # url(r'^books/latest/$', views_model_view_set.BookViewSet.as_view({'get': 'latest'})),
    # url(r'^books/(?P<pk>\d+)/read/$', views_model_view_set.BookViewSet.as_view({'put': 'read'}))
]

route = DefaultRouter()
route.register('books', views_model_view_set_2.BookViewSet, base_name='book')
urlpatterns += route.urls

print(urlpatterns)

'''
[
<RegexURLPattern book-list ^books_drf/$>,
<RegexURLPattern book-list ^books_drf\.(?P<format>[a-z0-9]+)/?$>,
<RegexURLPattern book-detail ^books_drf/(?P<pk>[^/.]+)/$>,
<RegexURLPattern book-detail ^books_drf/(?P<pk>[^/.]+)\.(?P<format>[a-z0-9]+)/?$>,
<RegexURLPattern api-root ^$>, <RegexURLPattern api-root ^\.(?P<format>[a-z0-9]+)/?$>
]
'''

'''
[
<RegexURLPattern book-list ^books/$>, 
<RegexURLPattern book-list ^books\.(?P<format>[a-z0-9]+)/?$>, 
<RegexURLPattern book-latest ^books/latest/$>, 
<RegexURLPattern book-latest ^books/latest\.(?P<format>[a-z0-9]+)/?$>, 
<RegexURLPattern book-detail ^books/(?P<pk>[^/.]+)/$>, 
<RegexURLPattern book-detail ^books/(?P<pk>[^/.]+)\.(?P<format>[a-z0-9]+)/?$>, 
<RegexURLPattern book-read ^books/(?P<pk>[^/.]+)/read/$>, 
<RegexURLPattern book-read ^books/(?P<pk>[^/.]+)/read\.(?P<format>[a-z0-9]+)/?$>, 
<RegexURLPattern api-root ^$>, 
<RegexURLPattern api-root ^\.(?P<format>[a-z0-9]+)/?$>
]
'''
